<template>
	<section>
		<!--start 面包屑-->
		<div class="location">
			<el-breadcrumb separator="/">
				<el-breadcrumb-item :to="{path:'/index'}">首页</el-breadcrumb-item>
				<el-breadcrumb-item :to="{path:'/goods'}">商品</el-breadcrumb-item>
				<el-breadcrumb-item :to="{path:'/goods'}">商品列表</el-breadcrumb-item>
				<el-breadcrumb-item>商品修改</el-breadcrumb-item>
			</el-breadcrumb>
		</div>
		<!--end 面包屑-->
		<!--start content-->
		<div class="wrap addGoodsWrap">
			<el-form :model="addGoodsData" :rules="rule" ref="ruleForm" label-width="100px" class="scroll formFontSizeMini">
				<!--start 基础信息-->
				<el-row :gutter="20">
					<el-col :span="24">
						<div class="title">
							基础信息
							<el-checkbox v-model="addGoodsData.basicInfo.isPutaway" size="small">立即上架</el-checkbox>
						</div>
					</el-col>
				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="商品名称" prop="goodsName">
							<el-input v-model="addGoodsData.goodsName" placeholder="长度<128,必填"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="品牌" prop="">
							<el-select @change="vFun_brand_selectChange" popper-class="posi" class="selectWidth" v-model="addGoodsData.basicInfo.brandCode" placeholder="">
								<el-option v-for="(item,index) in addGoodsData.basicInfo.brandCodeList" :label="item.brandName" :value="item.brandCode"></el-option>
								<el-option value='add' class="kael"><span class="iconfont" @click="vFun_brand_addBtn">&#xec52;&nbsp;新增商品品牌</span></el-option>
							</el-select>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="商品分类" prop="categoryCode">
							<el-input v-show="false" v-model="addGoodsData.categoryCode"></el-input>
							<div class="departmentSelectDiv">
								<span @click.stop="departmentFn" :class="{redBorder:addGoodsData.categoryRedB}">{{addGoodsData.basicInfo.categoryName}}</span>
								<i class="el-icon-caret-bottom" :class="{up:addGoodsData.basicInfo.treeShow}"></i>
								<transition name="selectSlide">
									<div class="goodsCate" v-show="addGoodsData.basicInfo.treeShow">
										<el-tree class="departmentTree" :data="addGoodsData.basicInfo.categoryTree" :props="addGoodsData.basicInfo.categoryProps" node-key="treeCode" accordion :expand-on-click-node="false" @node-click="handleNodeClick">
										</el-tree>
										<div class="goodsCateBtn" @click="vFun_goodsCate_addBtn"><span class="iconfont">&#xec52;&nbsp;新增商品分类</span></div>
									</div>
								</transition>
							</div>
						</el-form-item>
					</el-col>


					<el-dialog title="新增商品分类" :close-on-click-modal="false" :show-close='false' custom-class="goodsCate_dialogShow" :visible.sync="vue_goodsCate_dialogShow">
					  <el-form :model="vue_goodsCate_addData" :rules="vue_rules" ref='addGoodsCate'>
					    <el-form-item label="分类名称" label-width="90px" prop="categoryName">
					      <el-input v-model="vue_goodsCate_addData.categoryName" auto-complete="off"></el-input>
					    </el-form-item>
					    <el-form-item label="上级分类" label-width="90px">
					        <el-input v-show="false" v-model="vue_goodsCate_addData.categoryParentCode"></el-input>
							<div class="departmentSelectDiv">
								<span @click.stop="vFun_departmentFn">{{vue_goodsCate_addData.categoryParentName}}</span>
								<i class="el-icon-caret-bottom" :class="{up:vue_goodsCate_addData.treeShow}"></i>
								<transition name="selectSlide">
									<div class="goodsCateAdd" v-show="vue_goodsCate_addData.treeShow">
										<el-tree class="departmentTreeAdd" :data="vue_goodsCate_dialogData" :props="addGoodsData.basicInfo.categoryProps" node-key="treeCode" accordion :expand-on-click-node="false" @node-click="vFun_categoryCode_treeSelect">
										</el-tree>
									</div>
								</transition>
							</div>
					    </el-form-item>
					  </el-form>
					  <div slot="footer">
					    <el-button type="primary" @click="vFun_goodsCate_addOk">确 定</el-button>
					    <el-button @click="vFun_goodsCate_cancel">取 消</el-button>
					  </div>
					</el-dialog>


					<el-col :span="12">
						<el-form-item label="排序值" prop="" class="orderByDiv">
							<el-input v-model="addGoodsData.basicInfo.orderBy" placeholder=""></el-input>
							<span class="btnSpan orderByBtnAdd" onselectstart="return false" @click="orderByAdd">+</span>
							<span class="btnSpan orderByBtnSub" onselectstart="return false" @click="orderBySub">-</span>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="计量单位" prop="goodsNumUnitName">
							<el-select @change="vFun_goodsNumUnit_selectChange" popper-class="posi" class="selectWidth" v-model="addGoodsData.goodsNumUnitName" placeholder="">
								<el-option v-for="(item,index) in addGoodsData.basicInfo.goodsNumUnitList" :label="item.unitName" :value="item.unitName"></el-option>
								<el-option value='add' class="kael"><span class="iconfont" @click="vFun_goodsNumUnit_addBtn">&#xec52;&nbsp;新增计量单位</span></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="搜索关键字" prop="">
							<el-input v-model="addGoodsData.basicInfo.goodsKeywords" placeholder=""></el-input>
						</el-form-item>
					</el-col>
				</el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="显示名称" prop="">
              <el-input v-model="addGoodsData.basicInfo.goodsShowName" placeholder=""></el-input>
            </el-form-item>
          </el-col>
        </el-row>
				<el-row :gutter="20">
					<el-col :span="24">
						<el-form-item label="商品标签" prop="">
							<label class="goodsLabel" v-for="(item,index) in addGoodsData.basicInfo.goodsTagsList">
								<span class="checkboxSpan" :class="{active:item.isCheckbox}">
									<input type="checkbox" class="checkboxInput" v-model="item.isCheckbox">
								</span>
								<span class="checkboxText">{{item.ddlistName}}</span>
							</label>
						</el-form-item>
					</el-col>
				</el-row>
				<!--end 基础信息-->
				<!--start 商品规格-->
				<el-row :gutter="20">
					<el-col :span="24">
						<div class="title">
							商品规格
						</div>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<div class="tableWrap">
							<table border="0" cellspacing="0" cellpadding="0" class="showStandardTable">
								<colgroup>
									<col style="width: 4%" />
									<col style="width: 5%" />
									<col style="width: 10%" />
									<col style="width: 10%" />
									<col style="width: 10%" />
									<col style="width: 20%" />
								</colgroup>
								<tr>
									<th class="borderR"></th>
									<th class="borderR">主图</th>
									<th class="borderR" v-show="addGoodsData.goodsStandard.addStandard.one.isShow">{{addGoodsData.goodsStandard.addStandard.one.standardName}}</th>
									<th class="borderR" v-show="addGoodsData.goodsStandard.addStandard.two.isShow">{{addGoodsData.goodsStandard.addStandard.two.standardName}}</th>
									<th class="borderR" v-show="addGoodsData.goodsStandard.addStandard.three.isShow">{{addGoodsData.goodsStandard.addStandard.three.standardName}}</th>
									<th class="borderR">市场价（元）</th>
									<th>条形码</th>
								</tr>
								<tr @mouseenter="trHoverFnEnter(index)" @mouseleave="trHoverFnLeave(index)" v-for="(item,index) in addGoodsData.goodsStandard.saleGoodsSkuViewVoList">
									<td @click="delStandardFn(index)" class="borderR borderT cursorPo">{{item.standardIsDelText}}</td>
									<td class="borderR borderT cursorPo addPicTd goodsBigImg" style="padding: 0;position:relative;" @click.stop="nowIndex(index)">
										<el-upload ref="goodsBigImg" class="avatar-uploader" list-type="picture-card" :file-list="vue_goodsList" :action="addGoodsData.uploadUrl" :data="addGoodsData.goodsStandard.uploadData" :on-remove="vFun_upload_remove" :on-success="vFun_upload_success" :on-error="vFun_upload_error" :before-upload="vFun_upload_before">
											<i class="avatar-uploader-icon" :class="{'el-icon-plus':!item.uploading,'el-icon-loading':item.uploading}"></i>
										</el-upload>
									</td>
									<td class="borderR borderT" v-show="addGoodsData.goodsStandard.addStandard.one.isShow">{{item.standardValOne}}</td>
									<td class="borderR borderT" v-show="addGoodsData.goodsStandard.addStandard.two.isShow">{{item.standardValTwo}}</td>
									<td class="borderR borderT" v-show="addGoodsData.goodsStandard.addStandard.three.isShow">{{item.standardValThree}}</td>
									<td class="borderT">
										<el-input v-model="vue_goods_pic" :disabled="!item.standardIsDel"></el-input>
									</td>
									<td class="borderT">
										<el-input v-model="item.standardBarCode" :disabled="!item.standardIsDel"></el-input>
									</td>
								</tr>
							</table>
						</div>
					</el-col>
				</el-row>
				<!--end 商品规格-->
				<!--start 商品价格-->
				<el-row :gutter="20">
					<el-col :span="24">
						<div class="title Tbuttom">
							商品价格
						</div>
					</el-col>
				</el-row>
				<el-row :gutter="0">
					<!--<el-col :span="6">
						<el-form-item label="市场价" prop="goodsSalePrice">
							<el-input v-model="addGoodsData.goodsSalePrice"></el-input>
						</el-form-item>
					</el-col>-->
					<el-col :span="6">
						<el-form-item label="参考成本价" prop="goodsSalePrice1">
							<el-input v-model="addGoodsData.goodsSalePrice1"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<div class="addgoodTab" style="margin-bottom:40px;">
					<el-table :data="memberGradeData" border :align="center" style="width: 100%">
						<el-table-column prop="gradeName" label="客户级别" min-width="400" align="center">
						</el-table-column>
						<el-table-column prop="gradeDiscount" label="默认折扣" min-width="150" align="center">
							<template scope="scope">
								<span>{{scope.row.gradeDiscount}}%</span>
							</template>
						</el-table-column>
						<el-table-column prop="gradePriceValue" label="折扣价" min-width="180" align="center">
							<template scope="scope">
								<el-input v-model="scope.row.gradePriceValue"></el-input>
							</template>
						</el-table-column>
					</el-table>
				</div>
				<!--end 商品价格-->
				<!--start 商品图片-->
				<el-row :gutter="20">
					<el-col :span="24">
						<div class="title">
							商品图片
						</div>
					</el-col>
				</el-row>
				<el-row :gutter="20" style="padding-left: 10px;margin-bottom: 22px;">
					<el-upload :action="addGoodsData.uploadUrl" list-type="picture-card" :file-list="vue_picGoodsList" :data="addGoodsData.goodsStandard.uploadData_des" :before-upload="picvFun_upload_before" :on-change="picvFun_upload_change" :on-error="picvFun_upload_error" :on-remove="picvFun_upload_remove" :on-success="picvFun_upload_success">
						<i class="el-icon-plus">
					  </i>
					</el-upload>
				</el-row>
				<!--end 商品图片-->
				<!--start 商品描述-->
				<el-row :gutter="20">
					<el-col :span="24">
						<el-tabs v-model="addGoodsData.goodsDes.title" class="addGoodsTabs" @tab-click="handleClick">
							<el-tab-pane label="商品描述" name="1">
								<script id="addGoodsEditor1" type="text/plain" style="width:99%;height:400px;"></script>
							</el-tab-pane>
							<el-tab-pane label="售后保障" name="2">
								<script id="addGoodsEditor2" type="text/plain" style="width:99%;height:400px;"></script>
							</el-tab-pane>
						</el-tabs>
					</el-col>
				</el-row>
				<!--<el-row :gutter="20" style="padding-left: 10px;margin-bottom: 22px;">
					<quill-editor class="quillEditor" ref="myTextEditor" v-model="addGoodsData.goodsDes.content" :config="addGoodsData.goodsDes.editorOption"></quill-editor>
				</el-row>-->
				<!--end 商品描述-->
			</el-form>
		</div>
		<div class="btnBox" :class="{btnBox1:!$store.state.headFold}">
			<el-button type="primary" @click="saveFn">保存</el-button>
			<el-button @click="cancel" style="margin-right: 20px;">取消</el-button>
			<el-checkbox v-model="updateAll">修改所有同名商品设置</el-checkbox>
		</div>
		<!--end content-->
	</section>
</template>

<script>
	const UE = require('UE'); // eslint-disable-line
	import VueCoreImageUpload from 'vue-core-image-upload';
	export default {
		data() {
			var category = (rule, value, callback) => {
				if(!value) {
					this.addGoodsData.categoryRedB = true;
					return callback(new Error('商品分类不能为空'));
				} else {
					this.addGoodsData.categoryRedB = false;
					callback();
				}
			};
			var goodsSalePrice = (rule, value, callback) => {
				if(!value) {
					return callback(new Error('市场价不能为空'));
				} else if(isNaN(Number(value))) {
					return callback(new Error('请输入数字'));
				} else {
					callback();
				}
			};
			var goodsSalePrice1 = (rule, value, callback) => {
				if(!value) {
					return callback(new Error('成本价不能为空'));
				} else if(isNaN(Number(value))) {
					return callback(new Error('请输入数字'));
				} else {
					callback();
				}
			};
			return {
				vue_goods_pic: 0, //商品市场价
				vue_goodsList: [], //商品的主图
				vue_picGoodsList: [], //商品描述图
				vue_picGoodsListLength: 0, //商品描述图的数量
				vue_picGoodsListOld: [], //商品描述图备用数据
				vue_goodsCate_dialogShow:false,  //商品分类的下拉项里的addBtn点击后的弹框，显示与否控制变量
				vue_goodsCate_dialogData:[],  //新增商品分类的data
				vue_goodsCate_addData:{  //新增商品分类的data
					categoryName:'',
					categoryParentCode:'-1',
					categoryParentName:'根类别',
					treeShow:false
				},
				vue_rules:{
					categoryName: [{required: true, message: '分类名称不能为空', trigger: 'blur'},{required: true,min:0,max:10,message: '分类名称不能超过十个字',trigger: 'blur'}],
				},
				center: "",
				memberGradeData: [],
				updateAll: false,
				addGoodsData: {
					saleCode: "",
					goodsName: "", //商品名称
					categoryCode: "", //商品分类code
					categoryRedB: false,
					goodsNumUnitName: "", //计量单位
					goodsSalePrice: "", //参考市场价
					goodsSalePrice1: "", //成本价
					basicInfo: {
						isPutaway: false, //是否立即上架
						goodsName: "", //商品名称
						brandCodeList: [], //所有的商品品牌
						brandCode: "", //商品品牌
						categoryTree: [], //商品分类treeData
						categoryProps: { //商品分类props
							children: 'children',
							label: 'treeName'
						},
						categoryName: "", //商品分类name
						treeShow: false,
						categoryCode: "", //商品分类code
						orderBy: "", //排序值
						goodsNumUnitCode: "", //计量单位
						goodsNumUnitName: "",
						goodsNumUnitList: [], //计量单位List
						goodsKeywords: "", //搜索关键字123
            goodsShowName:"",   //显示名称
						goodsTags: "", //商品标签
						goodsTagsList: [], //商品标签List
					},
					goodsStandard: {
						uploadImgIndex: 0,
						canUpload: true, //是否可以上传
						moreStandard: false,
						addStandard: {
							one: {
								isShow: true,
								standardName: "规格",
								standardVal: [],
								standardList: []
							},
							two: {
								isShow: false,
								standardName: "规格2",
								standardVal: [],
								standardList: []
							},
							three: {
								isShow: false,
								standardName: "规格3",
								standardVal: [],
								standardList: []
							},
							addBtn: true
						},
						batchFill: {
							pic: "",
							cou: "",
							barCode: ""
						},
						standardViewVoList: [],
						allStandardViewVoList: [],
						saleGoodsSkuViewVoList: [{
							standardIsDel: true,
							standardIsDelText: "1",
							standardImg: "",
							standardValOne: "无",
							standardValTwo: "",
							standardValThree: "",
							standardPic: "",
							standardCou: "",
							standardBarCode: "",
							canUpload: true,
							uploading: false
						}],
						saleGoodsSkuViewVoListAjax: [],
						standardPicAjax: "",
						standardCouAjax: "",
						uploadData: {
							"moduleName": "Goods",
							"fileName": ""
						},
						uploadData_des: {
							"moduleName": "Goods",
							"fromTable": "SaleGoods",
							"fileName": "",
							"fromCode": ""
						}
					},
					goodsPic: {
						dialogImageUrl: "",
						dialogVisible: false,
						canUpload: true,
						fileListLength: 0,

					},
					goodsDes: {
						editor1: null,
						editor2: null,
						title: "1",
						editorOption: {
							// something config
						},
						content: "在这里输入。。",
						goodsDesc: "在这里输入。。",
						goodsDesc1: "在这里输入。。"
					},
					uploadUrl: "/v3/misc/common/uploadFile"
				},
				rule: {
					goodsName: [{
						required: true,
						message: '商品名称不能为空',
						trigger: 'blur'
					}, {
						required: true,
						min: 0,
						max: 128,
						message: '商品名称不能大于128个字符',
						trigger: 'blur'
					}],
					categoryCode: [{
						required: true,
						validator: category,
						trigger: 'blur'
					}],
					goodsNumUnitName: [{
						required: true,
						message: '计量单位不能为空',
						trigger: 'blur'
					}],
					goodsSalePrice: [{
						required: true,
						validator: goodsSalePrice,
						trigger: 'blur'
					}],
					goodsSalePrice1: [{
						required: true,
						validator: goodsSalePrice1,
						trigger: 'blur'
					}]
				}
			}
		},
		components: {
			VueCoreImageUpload
		},
		watch: {
			"vue_goods_pic": function(val) {
				console.log(val)
				if(this.memberGradeData.length && !isNaN(Number(val))) {
					this.memberGradeData.forEach((item, index, arr) => {
						item.gradePriceValue = (val * item.gradeDiscount * 0.01).toFixed(2)
					})
				}
			},
			"addGoodsData.goodsStandard.moreStandard": function(val, oldVal) {
				if(!val) {
					this.addGoodsData.goodsStandard.addStandard.one.isShow = true;
					this.addGoodsData.goodsStandard.addStandard.one.standardName = "规格";
					this.addGoodsData.goodsStandard.addStandard.one.standardVal = [];
					this.addGoodsData.goodsStandard.addStandard.one.standardList = [];
					this.addGoodsData.goodsStandard.addStandard.two.isShow = false;
					this.addGoodsData.goodsStandard.addStandard.two.standardName = "";
					this.addGoodsData.goodsStandard.addStandard.two.standardVal = "";
					this.addGoodsData.goodsStandard.addStandard.two.standardList = [];
					this.addGoodsData.goodsStandard.addStandard.three.isShow = false;
					this.addGoodsData.goodsStandard.addStandard.three.standardName = "";
					this.addGoodsData.goodsStandard.addStandard.three.standardVal = "";
					this.addGoodsData.goodsStandard.addStandard.three.standardList = [];
				} else {
					this.addGoodsData.goodsStandard.addStandard.one.standardName = "规格1";
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList = [{
						standardIsDel: true,
						standardIsDelText: "1",
						standardImg: "",
						standardValOne: "无",
						standardValTwo: "",
						standardValThree: "",
						standardPic: "",
						standardCou: "",
						standardBarCode: ""
					}]
				}
			},
			"addGoodsData.goodsStandard.addStandard.one.standardVal": function(val, oldVal) {
				this.newStandardArr();
			},
			"addGoodsData.goodsStandard.addStandard.two.standardVal": function(val, oldVal) {
				this.newStandardArr();
			},
			"addGoodsData.goodsStandard.addStandard.three.standardVal": function(val, oldVal) {
				this.newStandardArr();
			},
			"addGoodsData.goodsStandard.standardViewVoList": function(val, oldVal) {
				val.forEach((item, index, arr) => {
					this.$set(this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList, index, {
						standardIsDel: true,
						standardIsDelText: index + 1,
						standardImg: "",
						standardValOne: item.split(",")[0],
						standardValTwo: item.split(",")[1],
						standardValThree: item.split(",")[2],
						standardPic: "",
						standardCou: "",
						standardBarCode: "",
						imgSrc: ""
					})
				})
			},
			"addGoodsData.goodsStandard.batchFill.pic": function(val, oldVal) {
				this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList.forEach((item, index, arr) => {
					item.standardPic = val;
				})
			},
			"addGoodsData.goodsStandard.batchFill.cou": function(val, oldVal) {
				this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList.forEach((item, index, arr) => {
					item.standardCou = val;
				})
			},
			"addGoodsData.goodsStandard.batchFill.barCode": function(val, oldVal) {
				this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList.forEach((item, index, arr) => {
					item.standardBarCode = val;
				})
			},
			"addGoodsData.goodsName": function(val, oldVal) {
				this.addGoodsData.basicInfo.goodsName = val;
			},
			"addGoodsData.goodsNumUnitName": function(val, oldVal) {
				this.addGoodsData.basicInfo.goodsNumUnitName = val;
			}
		},
		methods: {
			vFun_brand_addBtn() { //品牌下拉的新增按钮新增
				this.addGoodsData.basicInfo.brandCode_old = this.addGoodsData.basicInfo.brandCode;
				this.$prompt('品牌名称', '新增商品品牌', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					customClass: "surePay clearfixBox",
					cancelButtonClass: 'fr',
					confirmButtonClass: 'fr',
					inputPattern: /.+/,
					inputErrorMessage: '商品品牌不能为空'
				}).then(({
					value
				}) => {
					this.axios({
						method: 'POST',
						url: '/v3/goods/brands',
						data: {
							"brandName": value
						}
					}).then((res) => {
						this.Public.openSuccess(this, "操作成功！");
						this.queryBrandList();
					}).catch((err) => {
						this.Public.openError(this, err.response.data);
					});
				}).catch(() => {
					//取消
				});
			},
			vFun_brand_selectChange(val) { //当点击的是新增品牌的按钮时，通过这个方法，把select的选择的值清空。
				if(val === 'add') {
					this.addGoodsData.basicInfo.brandCode = this.addGoodsData.basicInfo.brandCode_old;
				};
			},
			vFun_goodsNumUnit_addBtn() { //计量单位下拉的新增按钮新增
				this.addGoodsData.goodsNumUnitName_old = this.addGoodsData.goodsNumUnitName;
				this.$prompt('单位名称', '新增计量单位', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					customClass: "surePay clearfixBox",
					cancelButtonClass: 'fr',
					confirmButtonClass: 'fr',
					inputPattern: /.+/,
					inputErrorMessage: '计量单位不能为空'
				}).then(({
					value
				}) => {
					this.axios({
						method: 'post',
						url: '/v3/basic/units',
						data: {
							"unitName": value
						}
					}).then((res) => {
						this.Public.openSuccess(this, '操作成功！');
						this.queryUnit();
					}).catch((err) => {
						this.Public.openError(this, err.response.data);
					});
				}).catch(() => {
					//取消
				});
			},
			vFun_goodsNumUnit_selectChange(val) { //当点击的是新增单位的按钮时，通过这个方法，把select的选择的值清空。
				if(val === 'add') {
					this.addGoodsData.goodsNumUnitName = this.addGoodsData.goodsNumUnitName_old;
				};
			},
			vFun_goodsCate_addBtn() {
				this.vue_goodsCate_dialogShow=true;
			},
			vFun_departmentFn() {
				this.vue_goodsCate_addData.treeShow = !this.vue_goodsCate_addData.treeShow;
			},
			vFun_categoryCode_treeSelect(data) {
				this.vue_goodsCate_addData.categoryParentCode=data.treeCode;
				this.vue_goodsCate_addData.categoryParentName=data.treeName;
				this.vue_goodsCate_addData.treeShow=false;
			},
			vFun_goodsCate_addOk(){
				this.$refs['addGoodsCate'].validate(b=>{
					if(b){
						this.axios({
			              method: 'post',
			              url: "/v3/goods/categorys",
			              data: {
			                "categoryName": this.vue_goodsCate_addData.categoryName,
			                "categoryParentCode": this.vue_goodsCate_addData.categoryParentCode
			              }
			            }).then((res) => {
							this.vue_goodsCate_dialogShow=false;
			                this.$refs['addGoodsCate'].resetFields();
			                this.Public.openSuccess(this,'操作成功！');
			                this.querycategoryList();
			            }).catch((err)=>{
			                this.$refs['addGoodsCate'].resetFields();
			                this.Public.openError(this,err.response.data);
			            });
					}else{
						return false;
					}
				})
			},
			vFun_goodsCate_cancel(){
				this.$refs['addGoodsCate'].resetFields();
				this.vue_goodsCate_dialogShow=false;
			},
			/* start goodsBigImg图片上传 */
			nowIndex(index) {
				if(this.addGoodsData.goodsStandard.canUpload) {
					this.addGoodsData.goodsStandard.uploadImgIndex = index;
				} else {
					this.Public.openError(this, "上一张图片上传中，请稍等...")
				}
			},
			vFun_upload_before(file) {
				this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[this.addGoodsData.goodsStandard.uploadImgIndex].uploading = true;
				this.addGoodsData.goodsStandard.canUpload = false;
				this.addGoodsData.goodsStandard.uploadData.fileName = file.name;
				const typeArr = ['png', 'jpg', 'jpeg']; //定义上传的类型
				const isLt2M = file.size / 1024 / 1024 <= 2;
				let FileName = file.name.substr(file.name.lastIndexOf('.') + 1); //得到上传的类型

				if(typeArr.indexOf(FileName) === -1) { //判断类型
					this.Public.openError(this, "上传头像图片只能是 JPG和PNG 格式!")
					this.addGoodsData.goodsStandard.canUpload = true;
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[this.addGoodsData.goodsStandard.uploadImgIndex].uploading = false;
				}

				if(!isLt2M) { //判断大小
					this.Public.openError(this, "上传附件大小不能超过2MB!")
					this.addGoodsData.goodsStandard.canUpload = true;
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[this.addGoodsData.goodsStandard.uploadImgIndex].uploading = false;
				}
				return(typeArr.indexOf(FileName) !== -1) && isLt2M;
			},
			vFun_upload_success(res, file, fileList) {
				this.addGoodsData.goodsStandard.canUpload = true;
				this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[this.addGoodsData.goodsStandard.uploadImgIndex].uploading = false;
				this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[this.addGoodsData.goodsStandard.uploadImgIndex].standardImg = res;
			},
			vFun_upload_error(err, file, fileList) {
				this.addGoodsData.goodsStandard.canUpload = true;
				this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[this.addGoodsData.goodsStandard.uploadImgIndex].uploading = false;
			},
			vFun_upload_remove(file, fileList) {
				if(!fileList.length) {
					console.log(this.addGoodsData.goodsStandard.uploadImgIndex)
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[this.addGoodsData.goodsStandard.uploadImgIndex].standardImg = '';
				}
			},
			/* end goodsBigImg图片上传 */

			//-----------------------------/* start 商品图片 */
			picvFun_upload_before(file) { //上传之前
				this.addGoodsData.goodsStandard.uploadData_des.fileName = file.name;
				const typeArr = ['png', 'jpg', 'jpeg']; //定义上传的类型
				const isLt2M = file.size / 1024 / 1024 <= 2;
				let FileName = file.name.substr(file.name.lastIndexOf('.') + 1); //得到上传的类型

				if(this.vue_picGoodsListLength > 20) {
					this.Public.openError(this, "最多只能上传20张")
				};
				if(typeArr.indexOf(FileName) === -1) { //判断类型
					this.Public.openError(this, "上传头像图片只能是 JPG和PNG 格式!")
				};
				if(!isLt2M) { //判断大小
					this.Public.openError(this, "上传附件大小不能超过2MB!")
				};
				return(typeArr.indexOf(FileName) !== -1) && isLt2M && this.vue_picGoodsListLength <= 20;
			},
			picvFun_upload_error(file) { //上传失败
				this.Public.openError(this, '上传失败，请重新上传！')
			},
			picvFun_upload_change(file, fileList) {
				this.vue_picGoodsListLength = fileList.length;
			},
			picvFun_upload_remove(file, fileList) { //移除图片
				this.vue_picGoodsListLength = fileList.length;
				this.axios({
					method: "DELETE",
					url: "/v3/basic/files/delete",
					data: {
						"fromTable": "SaleGoods",
						"fromCode": this.addGoodsData.goodsStandard.uploadData_des.fromCode,
						"fileUrl": file.response || file.fileUrl
					}
				}).then((res) => {
					this.Public.openSuccess(this, "操作成功！");
					this.vue_picGoodsListOld = JSON.parse(JSON.stringify(fileList));
					this.vue_picGoodsList.length -= 1;
					this.vue_picGoodsListLength -= 1;
				}).catch((err) => {
					setTimeout(() => {
						this.vue_picGoodsList = JSON.parse(JSON.stringify(this.vue_picGoodsListOld));
					}, 800);
					this.Public.openError(this, err.response.data);
				})
			},
			picvFun_upload_success(response, file, fileList) { //上传成功
				this.vue_picGoodsListLength = fileList.length;
				this.vue_picGoodsListOld = JSON.parse(JSON.stringify(fileList));
				this.Public.openSuccess(this, "操作成功！")
			},
			/* end 商品图片 */
			/* start 请求商品品牌 */
			queryBrandList() {
				this.axios({
					method: 'post',
					url: "/v3/goods/brands/listAll",
					data: {}
				}).then((res) => {
					this.addGoodsData.basicInfo.brandCodeList = res.data.list;
				}).catch((err) => {
					this.Public.openError(this, err.response.data)
				});
			},
			/* end 请求商品品牌 */
			/* start 商品分类 */
			handleNodeClick(data) {
				this.addGoodsData.basicInfo.categoryCode = data.treeCode;
				this.addGoodsData.basicInfo.categoryName = data.treeName;
				this.addGoodsData.basicInfo.treeShow = false;
				this.addGoodsData.categoryCode = data.treeCode;
			},
			departmentFn() {
				this.addGoodsData.basicInfo.treeShow = !this.addGoodsData.basicInfo.treeShow;
			},
			querycategoryList() {
				this.axios({
					method: 'post',
					url: "/v3/goods/categorys/queryTree",
					data: {}
				}).then((res) => {
					this.addGoodsData.basicInfo.categoryTree = JSON.parse(JSON.stringify(res.data));
					this.vue_goodsCate_dialogData = JSON.parse(JSON.stringify(res.data));
					this.vue_goodsCate_dialogData.unshift({'treeName':'根类别','treeCode':'-1'});
				}).catch((err) => {
					this.Public.openError(this, err.response.data)
				});
			},
			/* end 商品分类 */
			/* start 排序 */
			orderByAdd() {
				if(!isNaN(parseInt(this.addGoodsData.basicInfo.orderBy))) {
					this.addGoodsData.basicInfo.orderBy = parseInt(this.addGoodsData.basicInfo.orderBy) + 1;
				} else {
					this.addGoodsData.basicInfo.orderBy = 0;
				}
			},
			orderBySub() {
				if(!isNaN(parseInt(this.addGoodsData.basicInfo.orderBy))) {
					if(parseInt(this.addGoodsData.basicInfo.orderBy) > 0) {
						this.addGoodsData.basicInfo.orderBy = parseInt(this.addGoodsData.basicInfo.orderBy) - 1;
					}
				} else {
					this.addGoodsData.basicInfo.orderBy = 0;
				}
			},
			/* start 排序 */
			/* start 计量单位 */
			queryUnit() {
				this.axios({
					method: 'post',
					url: "/v3/basic/units/listAll",
					data: {}
				}).then((res) => {
					this.addGoodsData.basicInfo.goodsNumUnitList = res.data.list;
				}).catch((err) => {
					this.Public.openError(this, err.response.data)
				});
			},
			/* end 计量单位 */
			/* start 商品标签 */
			queryBasicDdtype() {
				this.axios({
					method: "post",
					url: "/v3/basic/ddlists/00100000001/listAll",
					data: {}
				}).then((res) => {
					if(res.data.state == res.data.success) {
						res.data.list.forEach((item, index, arr) => {
							item.isCheckbox = false;
						})
						this.addGoodsData.basicInfo.goodsTagsList = res.data.list;
					} else {
						//
					}
				}).catch((err) => {
					this.Public.openError(this, err.response.data)
				});
			},
			/* start 商品标签 */
			/* start 商品规格 */
			addStandardLine() {
				if(this.addGoodsData.goodsStandard.addStandard.two.isShow) {
					this.addGoodsData.goodsStandard.addStandard.three.isShow = true;
					this.addGoodsData.goodsStandard.addStandard.addBtn = false;
				} else {
					this.addGoodsData.goodsStandard.addStandard.two.isShow = true;
				}
			},
			subStandardOne() {
				if(this.addGoodsData.goodsStandard.addStandard.two.isShow && this.addGoodsData.goodsStandard.addStandard.three.isShow) {
					this.addGoodsData.goodsStandard.addStandard.three.isShow = false;
					this.addGoodsData.goodsStandard.addStandard.three.standardName = "";
					this.addGoodsData.goodsStandard.addStandard.three.standardVal = "";
					this.addGoodsData.goodsStandard.addStandard.three.standardList = [];
					this.addGoodsData.goodsStandard.addStandard.addBtn = true;
				} else if(this.addGoodsData.goodsStandard.addStandard.two.isShow) {
					this.addGoodsData.goodsStandard.addStandard.two.isShow = false;
					this.addGoodsData.goodsStandard.addStandard.two.standardName = "";
					this.addGoodsData.goodsStandard.addStandard.two.standardVal = "";
					this.addGoodsData.goodsStandard.addStandard.two.standardList = [];
					this.addGoodsData.goodsStandard.addStandard.addBtn = true;
				} else {
					this.Public.openError(this, "规格启用时，必须保留一个规格")
				}
			},
			subStandardTwo() {
				if(this.addGoodsData.goodsStandard.addStandard.three.isShow) {
					this.addGoodsData.goodsStandard.addStandard.three.isShow = false;
					this.addGoodsData.goodsStandard.addStandard.three.standardName = "";
					this.addGoodsData.goodsStandard.addStandard.three.standardVal = "";
					this.addGoodsData.goodsStandard.addStandard.three.standardList = [];
					this.addGoodsData.goodsStandard.addStandard.addBtn = true;
				} else {
					this.addGoodsData.goodsStandard.addStandard.two.isShow = false;
					this.addGoodsData.goodsStandard.addStandard.two.standardName = "";
					this.addGoodsData.goodsStandard.addStandard.two.standardVal = "";
					this.addGoodsData.goodsStandard.addStandard.two.standardList = [];
					this.addGoodsData.goodsStandard.addStandard.addBtn = true;
				}
			},
			subStandardThree() {
				this.addGoodsData.goodsStandard.addStandard.three.isShow = false;
				this.addGoodsData.goodsStandard.addStandard.three.standardName = "";
				this.addGoodsData.goodsStandard.addStandard.three.standardVal = "";
				this.addGoodsData.goodsStandard.addStandard.three.standardList = [];
				this.addGoodsData.goodsStandard.addStandard.addBtn = true;
			},
			newStandardArr() {
				if(this.addGoodsData.goodsStandard.moreStandard) {
					this.addGoodsData.goodsStandard.standardViewVoList = [];
					this.addGoodsData.goodsStandard.allStandardViewVoList[0] = this.addGoodsData.goodsStandard.addStandard.one.standardVal;
					this.addGoodsData.goodsStandard.allStandardViewVoList[1] = this.addGoodsData.goodsStandard.addStandard.two.standardVal;
					this.addGoodsData.goodsStandard.allStandardViewVoList[2] = this.addGoodsData.goodsStandard.addStandard.three.standardVal;
					this.addGoodsData.goodsStandard.standardViewVoList = this.Public.arraysplitAll(this.addGoodsData.goodsStandard.allStandardViewVoList);
				} else {
					this.addGoodsData.goodsStandard.standardViewVoList = [];
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList = [{
						standardIsDel: true,
						standardIsDelText: "1",
						standardImg: "",
						standardValOne: "无",
						standardValTwo: "",
						standardValThree: "",
						standardPic: "",
						standardCou: "",
						standardBarCode: ""
					}]

				}
			},
			trHoverFnEnter(index) {
				if(this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[index].standardIsDel) {
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[index].standardIsDelText = "删除";
				}
			},
			trHoverFnLeave(index) {
				if(this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[index].standardIsDel) {
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[index].standardIsDelText = index + 1;
				}
			},
			delStandardFn(index) {
				/* 判断是否为最后一个删除 */
				let delLastRow = 0;
				this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList.forEach((item, index, arr) => {
					if(item.standardIsDel) {
						delLastRow++;
					}
				});
				/* 点击逻辑 */
				if(this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[index].standardIsDel) {
					if(1 < delLastRow) {
						this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[index].standardIsDelText = "恢复";
						this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[index].standardIsDel = 　false;
					} else {
						this.Public.openError(this, "请至少保留一种规格")
					}
				} else {
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[index].standardIsDelText = "删除";
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[index].standardIsDel = 　true;
				}
			},
			/* end 商品规格 */
			/* start 商品图片 */

			/* end 商品图片 */
			/* start goodsDes */

			/* end goodsDes */
			/* start save */
			saveFn() {
				this.$refs.ruleForm.validate((valid) => {
					if(valid) {
						/* start 对排序值进行处理 */
						this.addGoodsData.basicInfo.orderBy = isNaN(this.addGoodsData.basicInfo.orderBy * 1) ? "0" : this.addGoodsData.basicInfo.orderBy;
						/* end 对排序值进行处理 */
						/* start 对商品标签数据进行处理 */
						this.addGoodsData.basicInfo.goodsTags = "";
						this.addGoodsData.basicInfo.goodsTagsList.forEach((item, index, arr) => {
							if(item.isCheckbox) {
								this.addGoodsData.basicInfo.goodsTags += item.ddlistCode + ",";
							}
						});
						this.addGoodsData.basicInfo.goodsTags = this.addGoodsData.basicInfo.goodsTags.substring(0, this.addGoodsData.basicInfo.goodsTags.length - 1);
						/* end 对商品标签数据进行处理 */
						/* start 对商品规格进行处理 */
						let _index = 0;
						this.addGoodsData.goodsStandard.standardPicAjax = "";
						this.addGoodsData.goodsStandard.standardCouAjax = "";
						this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList.forEach((item, index, arr) => {
							item.standardPic = item.standardPic ? item.standardPic : "0";
							item.standardCou = item.standardCou ? item.standardCou : "0";
							if(item.standardIsDel) {
								this.addGoodsData.goodsStandard.saleGoodsSkuViewVoListAjax[_index] = {};
								this.addGoodsData.goodsStandard.saleGoodsSkuViewVoListAjax[_index].goodsBigPic = item.standardImg;
								if(this.addGoodsData.goodsStandard.addStandard.two.isShow && this.addGoodsData.goodsStandard.addStandard.three.isShow) {
									this.addGoodsData.goodsStandard.saleGoodsSkuViewVoListAjax[_index].goodsSkuValue = this.addGoodsData.goodsStandard.addStandard.one.standardName + ":" + item.standardValOne + "," + this.addGoodsData.goodsStandard.addStandard.two.standardName + ":" + item.standardValTwo + "," + this.addGoodsData.goodsStandard.addStandard.three.standardName + ":" + item.standardValThree;
								} else if(this.addGoodsData.goodsStandard.addStandard.two.isShow && !this.addGoodsData.goodsStandard.addStandard.three.isShow) {
									this.addGoodsData.goodsStandard.saleGoodsSkuViewVoListAjax[_index].goodsSkuValue = this.addGoodsData.goodsStandard.addStandard.one.standardName + ":" + item.standardValOne + "," + this.addGoodsData.goodsStandard.addStandard.two.standardName + ":" + item.standardValTwo;
								} else {
									this.addGoodsData.goodsStandard.saleGoodsSkuViewVoListAjax[_index].goodsSkuValue = this.addGoodsData.goodsStandard.addStandard.one.standardName + ":" + item.standardValOne;
								}
								this.addGoodsData.goodsStandard.saleGoodsSkuViewVoListAjax[_index].goodsBarCode = item.standardBarCode;
								this.addGoodsData.goodsStandard.standardPicAjax += item.standardPic + ",";
								this.addGoodsData.goodsStandard.standardCouAjax += item.standardCou + ",";
								_index++;
							}
						});
						this.addGoodsData.goodsStandard.standardPicAjax = this.addGoodsData.goodsStandard.standardPicAjax.substring(0, this.addGoodsData.goodsStandard.standardPicAjax.length - 1);
						this.addGoodsData.goodsStandard.standardCouAjax = this.addGoodsData.goodsStandard.standardCouAjax.substring(0, this.addGoodsData.goodsStandard.standardCouAjax.length - 1);
						/* end 对商品规格进行处理 */
						/* start 对 goodsDes数据进行处理*/
						/* end 对 goodsDes数据进行处理*/
						/* start 请求save接口 */
						if(this.updateAll) {
							this.axios({
								method: "patch",
								url: "/v3/sale/goodss/" + this.addGoodsData.saleCode + "/updateBySaleCode",
								data: {
									"goodsCode": this.Public.getCookie("updateGoodsCode"),
									"saleCode": this.addGoodsData.saleCode,
									"goodsName": this.addGoodsData.basicInfo.goodsName,
									"brandCode": this.addGoodsData.basicInfo.brandCode,
									"categoryCode": this.addGoodsData.basicInfo.categoryCode,
									"orderBy": this.addGoodsData.basicInfo.orderBy,
									"goodsNumUnit": this.addGoodsData.basicInfo.goodsNumUnitName,
									"goodsKeywords": this.addGoodsData.basicInfo.goodsKeywords,
									"goodsShowName":this.addGoodsData.basicInfo.goodsShowName,
									"goodsTags": this.addGoodsData.basicInfo.goodsTags,
									"goodsBarCode": this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardBarCode,
									"goodsNum": this.addGoodsData.goodsStandard.standardCouAjax,
									"goodsSalePrice": this.addGoodsData.goodsSalePrice,
									"goodsSalePrice1": this.addGoodsData.goodsSalePrice1,
									"goodsSalePriceStr": JSON.stringify(this.memberGradeData),
									"goodsDesc": this.addGoodsData.goodsDes.goodsDesc,
									"goodsDesc1": this.addGoodsData.goodsDes.goodsDesc1,
									"applyChoice":this.addGoodsData.basicInfo.isPutaway
								}
							}).then((res) => {
								this.$router.push({
									path: "/goods"
								})
								this.Public.openSuccess(this, "操作成功！");
							}).catch((err) => {
								this.Public.openError(this, err.response.data)
							});
						} else {
							this.axios({
								method: "put",
								url: "/v3/sale/goodss",
								data: {
									"goodsCode": this.Public.getCookie("updateGoodsCode"),
									"goodsName": this.addGoodsData.basicInfo.goodsName,
									"brandCode": this.addGoodsData.basicInfo.brandCode,
									"categoryCode": this.addGoodsData.basicInfo.categoryCode,
									"orderBy": this.addGoodsData.basicInfo.orderBy,
									"goodsNumUnit": this.addGoodsData.basicInfo.goodsNumUnitName,
									"goodsKeywords": this.addGoodsData.basicInfo.goodsKeywords,
									"goodsShowName":this.addGoodsData.basicInfo.goodsShowName,
									"goodsTags": this.addGoodsData.basicInfo.goodsTags,
									"goodsBarCode": this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardBarCode,
									"goodsNum": this.addGoodsData.goodsStandard.standardCouAjax,
									"goodsSalePrice": this.vue_goods_pic,
									"goodsSalePrice1": this.addGoodsData.goodsSalePrice1,
									"goodsSalePriceStr": JSON.stringify(this.memberGradeData),
									"goodsDesc": this.addGoodsData.goodsDes.goodsDesc,
									"goodsDesc1": this.addGoodsData.goodsDes.goodsDesc1,
									"goodsBigPic": this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[this.addGoodsData.goodsStandard.uploadImgIndex].standardImg,
								    "applyChoice":this.addGoodsData.basicInfo.isPutaway
								}
							}).then((res) => {
								this.$router.push({
									path: "/goods"
								})
								this.Public.openSuccess(this, "操作成功！");
							}).catch((err) => {
								this.Public.openError(this, err.response.data)
							});
						}
						/* end 请求save接口 */
					} else {
						this.Public.openError(this, "按页面提示信息修改后才能提交")
						return false;
					}
				})
			},
			/* end save */
			/* start cancel */
			cancel() {
				this.$router.go(-1)
			},
			/* end cancel */
			handleRemove(file, fileList) {
				console.log(file, fileList);
			},
			handlePictureCardPreview(file) {
				this.addGoodsData.goodsPic.dialogImageUrl = file.url;
				this.addGoodsData.goodsPic.dialogVisible = true;
			},
			handleClick(tab, event) {
				if("1" == this.addGoodsData.goodsDes.title) {
					//    		this.addGoodsData.goodsDes.content = this.addGoodsData.goodsDes.goodsDesc;
					//    		this.editorReady();
					//					console.log(this.addGoodsData.goodsDes.goodsDesc)
					//					console.log(this.addGoodsData.goodsDes.goodsDesc1)
					//					console.log(UE)
					//					console.log(UE.Editor)
					//					UE.Editor.setContent("123")
				} else if("2" == this.addGoodsData.goodsDes.title) {
					//    		this.addGoodsData.goodsDes.content = this.addGoodsData.goodsDes.goodsDesc1;
					//    		this.editorReady();
					//					console.log(this.addGoodsData.goodsDes.goodsDesc)
					//					console.log(this.addGoodsData.goodsDes.goodsDesc1)
					//					console.log(UE)
					//					console.log(UE.Editor)
					//					UE.Editor.setContent("456")
				}
			},
			/* start 客户级别 */
			/*queryListAll(){
      			this.axios({
							method: 'POST',
							url:"/v3/member/grades/list",
							data:{}
						}).then((res) => {
							console.log(res)
							this.memberGradeData = res.data.list;
						}).catch((err)=>{
							this.Public.openError(this,err.response.data)
						});
      		},*/
			/* end 客户级别 */
			/* start 请求商品的相关数据 */
			queryViewVo() {
				this.axios({
					method: "POST",
					url: "/v3/sale/goodss/" + this.Public.getCookie("updateGoodsCode") + "/queryGoodsAndGradePriceData",
					data: {}
				}).then(res => {
					this.vue_goods_pic = res.data.list[0].goodsSalePrice;
					if(!!res.data.list[0].basicFileVoList) {
						this.vue_picGoodsList = res.data.list[0].basicFileVoList; //获取商品的描述图片
						this.vue_picGoodsList.forEach((item) => { //给商品的描述图片数组加上url属性，如果不加，页面上不会回显
							item.url = item.fileUrl;
						});
						this.vue_picGoodsListOld = JSON.parse(JSON.stringify(this.vue_picGoodsList)); //保存商品描述图片的数组，备用
					};
					this.addGoodsData.goodsStandard.uploadData_des.fromCode = res.data.list[0].saleCode;
					this.$set(this.vue_goodsList, 0, {
						'url': res.data.list[0].goodsBigPic,
						'name': '商品主图'
					})
					this.addGoodsData.saleCode = res.data.list[0].saleCode;
					this.addGoodsData.goodsName = res.data.list[0].goodsName;
					this.addGoodsData.basicInfo.brandCode = res.data.list[0].brandCode;
					this.addGoodsData.categoryCode = res.data.list[0].categoryCode;
					this.addGoodsData.basicInfo.categoryCode = res.data.list[0].categoryCode;
					this.addGoodsData.basicInfo.categoryName = res.data.list[0].categoryName;
					this.addGoodsData.basicInfo.orderBy = res.data.list[0].orderBy;
					this.addGoodsData.goodsNumUnitName = res.data.list[0].goodsNumUnit;
					this.addGoodsData.goodsSalePrice = res.data.list[0].goodsSalePrice;
					this.addGoodsData.goodsSalePrice1 = res.data.list[0].goodsSalePrice1;
					this.addGoodsData.basicInfo.goodsKeywords = res.data.list[0].goodsKeywords;
          this.addGoodsData.basicInfo.goodsShowName = res.data.list[0].goodsShowName;
					this.addGoodsData.goodsDesc = res.data.list[0].goodsDesc;
					this.addGoodsData.goodsDesc1 = res.data.list[0].goodsDesc1;
					//   			this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].imgSrc = res.data. list[0].goodsBigPic;
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardPic = res.data.list[0].goodsSalePrice;
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardCou = res.data.list[0].goodsNum;
					this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardBarCode = res.data.list[0].goodsBarCode; ///////////////
					let goodsTagsList = res.data.list[0].goodsTags.split(",");
					this.addGoodsData.basicInfo.goodsTagsList.forEach((item, index, arr) => {
						goodsTagsList.forEach((itemC, indexC, arrC) => {
							if(item.ddlistCode == itemC) {
								item.isCheckbox = true;
							}
						})
					});
					UE.getEditor('addGoodsEditor1').ready(function() {
						UE.getEditor('addGoodsEditor1').setContent(res.data.list[0].goodsDesc); //赋值给UEditor
					});
					UE.getEditor('addGoodsEditor2').ready(function() {
						UE.getEditor('addGoodsEditor2').setContent(res.data.list[0].goodsDesc1); //赋值给UEditor
					});
					let goodsSkuValueList = res.data.list[0].goodsSkuValue.split(",");
					switch(goodsSkuValueList.length) {
						case 1:
							this.addGoodsData.goodsStandard.addStandard.one.isShow = true;
							this.addGoodsData.goodsStandard.addStandard.one.standardName = goodsSkuValueList[0].split(":")[0];
							this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardValOne = goodsSkuValueList[0].split(":")[1];
							this.addGoodsData.goodsStandard.addStandard.two.isShow = false;
							this.addGoodsData.goodsStandard.addStandard.three.isShow = false;
							break;
						case 2:
							this.addGoodsData.goodsStandard.addStandard.one.isShow = true;
							this.addGoodsData.goodsStandard.addStandard.one.standardName = goodsSkuValueList[0].split(":")[0];
							this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardValOne = goodsSkuValueList[0].split(":")[1];
							this.addGoodsData.goodsStandard.addStandard.two.isShow = true;
							this.addGoodsData.goodsStandard.addStandard.two.standardName = goodsSkuValueList[1].split(":")[0];
							this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardValTwo = goodsSkuValueList[1].split(":")[1];
							this.addGoodsData.goodsStandard.addStandard.three.isShow = false;
							break;
						case 3:
							this.addGoodsData.goodsStandard.addStandard.one.isShow = true;
							this.addGoodsData.goodsStandard.addStandard.one.standardName = goodsSkuValueList[0].split(":")[0];
							this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardValOne = goodsSkuValueList[0].split(":")[1];
							this.addGoodsData.goodsStandard.addStandard.two.isShow = true;
							this.addGoodsData.goodsStandard.addStandard.two.standardName = goodsSkuValueList[1].split(":")[0];
							this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardValTwo = goodsSkuValueList[1].split(":")[1];
							this.addGoodsData.goodsStandard.addStandard.three.isShow = true;
							this.addGoodsData.goodsStandard.addStandard.three.standardName = goodsSkuValueList[2].split(":")[0];
							this.addGoodsData.goodsStandard.saleGoodsSkuViewVoList[0].standardValThree = goodsSkuValueList[2].split(":")[1];
							break;
					}
					/*得到商品等级价格数据*/
					this.memberGradeData = res.data.list[0].goodsAllGradePriceList;
					/*判断商品是否出售中:出售中则设置立即上架为true*/
					res.data.list[0].dataBillstate=="6"?this.addGoodsData.basicInfo.isPutaway=true:this.addGoodsData.basicInfo.isPutaway=false;
				}).catch(err => {
					this.Public.openError(this, err.response.data)
				});
			}
			/* end 请求商品的相关数据 */
		},
		created() {
			this.queryBrandList(); //请求商品品牌数据
			this.querycategoryList(); //请求商品分类数据
			this.queryUnit(); //请求计量单位
			this.queryBasicDdtype(); //请求商品标签
			//this.queryListAll(); //请求客户级别
		},
		mounted() {
			let _this = this;
			this.addGoodsData.goodsDes.editor1 = UE.getEditor('addGoodsEditor1');
			this.addGoodsData.goodsDes.editor2 = UE.getEditor('addGoodsEditor2');
			this.addGoodsData.goodsDes.editor1.addListener("contentChange", function() {
				_this.addGoodsData.goodsDes.goodsDesc = this.getContent()
			});
			this.addGoodsData.goodsDes.editor2.addListener("contentChange", function() {
				_this.addGoodsData.goodsDes.goodsDesc1 = this.getContent()
			})
			this.queryViewVo(); //请求商品的相关数据
			document.querySelector(".addGoodsWrap form").style.height = (document.documentElement.clientHeight - 180) + 'px';
			document.querySelector("body").onclick = () => {
				this.addGoodsData.basicInfo.treeShow = false;
			}
		},
		destroyed() {
			this.addGoodsData.goodsDes.editor1.destroy();
			this.addGoodsData.goodsDes.editor2.destroy();
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
		transition: .2s;
	}

	section {
		display: flex;
		flex-direction: column;
		flex: 1;
	}

	div.location {
		flex: 0 0 10px;
		padding: 3px 0 15px 0;
	}

	div.wrap {
		position: relative;
		flex: 1;
		width: 100%;
		padding: 15px 20px 0 20px;
		box-sizing: border-box;
		background: #fff;
	}

	div.wrap>form {
		overflow-y: auto;
	}

	.scroll {
		overflow-y: auto;
		overflow-x: hidden;
		padding-right: 20px;
	}

	.title {
		height: 50px;
		color: #03B8CC;
		font-size: 16px;
	}

	.selectWidth {
		width: 100%;
	}
	/* start 基础信息 */
	/* start 商品分类下拉的样式 */

	.departmentSelectDiv {
		position: relative;
		width: 100%;
		height: 36px;
		line-height: 36px;
	}

	.departmentSelectDiv>span {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 36px;
		border: 1px solid rgb(191, 212, 217);
		border-radius: 4px;
		font-size: 12px;
		padding-left: 10px;
		cursor: pointer;
	}

	.departmentSelectDiv>span:hover {
		border-color: rgb(131, 156, 165);
	}

	.departmentSelectDiv>span:active {
		border-color: #03b8cc;
	}

	.departmentSelectDiv>span:visited {
		border-color: #03b8cc;
	}

	.departmentSelectDiv>span:focus {
		border-color: #03b8cc;
	}

	.departmentSelectDiv>i {
		position: absolute;
		top: 0;
		right: 0;
		width: 35px;
		height: 36px;
		line-height: 38px;
		text-align: center;
		color: rgb(191, 212, 217);
		transition: .3s;
		font-size: 12px;
	}

	.departmentSelectDiv>i.up {
		transform: rotate(180deg);
	}

	.goodsCate {
		position: absolute;
		width: 100%;
		height: 236px;
		top: 42px;
		left: 0;
		border-radius: 2px;
		box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
		border: 1px solid rgb(209, 225, 229);
		z-index: 2;
		font-size: 12px;
		background: #fff;
	}

	.goodsCateBtn {
		cursor: pointer;
		padding-left: 12px;
		line-height: 32px;
		border-top: 1px solid #e9e9e9;
	}

	.goodsCateBtn>span {
		font-size: 12px;
	}

	.departmentTree {
		width: 100%;
		z-index: 2;
		font-size: 12px;
		overflow-y: auto;
		height: 200px;
		border: 0;
	}
	/* start 商品分类的下拉新增 */
	.goodsCateAdd {
		position: absolute;
		width: 100%;
		top: 42px;
		left: 0;
		border-radius: 2px;
		box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
		border: 1px solid rgb(209, 225, 229);
		z-index: 2;
		font-size: 12px;
		background: #fff;
	}

	.departmentTreeAdd {
		width: 100%;
		z-index: 2;
		font-size: 12px;
		overflow-y: auto;
		height: 200px;
		border: 0;
	}
	/* end 商品分类的下拉新增 */

	.selectSlide-enter-active,
	.selectSlide-leave-active {
		transition: .4s;
	}

	.selectSlide-enter,
	.selectSlide-leave-active {
		height: 0;
		opacity: 0;
	}

	.redBorder {
		border-color: #ff4949 !important;
	}
	/* end 商品分类下拉的样式 */
	/* start 排序 */

	.orderByDiv .btnSpan {
		display: block;
		position: absolute;
		height: 18px;
		width: 18px;
		line-height: 18px;
		text-align: center;
		margin: 0;
		padding: 0;
		right: 0;
		cursor: pointer;
		z-index: 1800;
		border: 1px solid rgb(191, 212, 217);
		border-right: 0;
		-moz-user-select: none;
		/* 禁止文本被选中 */
	}

	.orderByDiv .btnSpan:hover {
		color: #13C19F;
	}

	.orderByDiv .btnSpan.orderByBtnAdd {
		top: 0;
		border-top: 0;
	}

	.orderByDiv .btnSpan.orderByBtnSub {
		top: 18px;
		border-bottom: 0;
	}
	/* start 排序 */
	/* end 基础信息 */
	/* start 商品规格 */

	.tableWrap {}

	.tableHeader {
		background-color: #eff1f8;
		padding: 0 10px;
		line-height: 50px;
	}

	.setStandardTable {
		width: 100%;
		background: #fff;
		border: 1px solid #e7e9f1;
		margin-bottom: 20px;
	}

	.setStandardTable tr:nth-of-type(1) th {
		padding: 20px 0 5px 5px;
		text-align: left;
		font-weight: 400;
	}

	.setStandardTable tr+tr:hover {
		background-color: #F8F9FD;
	}

	.setStandardTable tr td {
		padding: 5px;
		font-weight: 400;
		height: 50px;
		line-height: 50px;
	}

	.addBtnI:before {
		margin-right: 10px;
	}

	.batchOper {
		margin: 5px 0;
	}

	.batchOper span {
		display: inline-block;
	}

	.showStandardTable {
		width: 100%;
		background: #fff;
		border: 1px solid #e7e9f1;
		margin-bottom: 22px;
	}

	.showStandardTable tr:nth-of-type(1) th {
		height: 50px;
		line-height: 50px;
		text-align: center;
		font-weight: 400;
		background: #eff1f8;
	}

	.showStandardTable tr+tr:hover {
		background-color: #F8F9FD;
	}

	.showStandardTable tr td {
		padding: 5px;
		font-weight: 400;
		text-align: center;
		height: 50px;
		line-height: 50px;
	}

	.addPicTd {
		position: relative;
	}

	.cursorPo {
		cursor: pointer;
	}

	.textAlignC {
		text-align: center;
	}

	.borderL {
		border-left: 1px solid #e7e9f1;
	}

	.borderR {
		border-right: 1px solid #e7e9f1;
	}

	.borderT {
		border-top: 1px solid #e7e9f1;
	}

	.borderB {
		border-bottom: 1px solid #e7e9f1;
	}
	/* end 商品规格 */

	.btnBox {
		position: absolute;
		bottom: 10px;
		left: 180px;
		height: 50px;
		background: #fff;
		z-index: 100;
	}

	.btnBox1 {
		left: 98px;
	}
	/* start 商品标签 */

	.goodsLabel {
		display: inline-block;
		position: relative;
		min-width: 80px;
		line-height: 32px;
		padding: 0 20px;
		margin: 0 10px 10px 0;
		text-align: center;
		cursor: pointer;
	}

	.checkboxSpan {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		border: 1px solid #cdd9e6;
	}

	.checkboxSpan.active {
		background: url('../../../assets/img/goodsLabelCheckbox.png') 100% 100% no-repeat;
		border-color: #00c29f;
	}

	.checkboxInput {
		display: none;
	}

	.checkboxText {
		font-size: 12px;
	}
	/* end 商品标签 */
	/* start 富文本编辑器 */

	.quillEditor {
		width: 90%;
		height: 400px;
		margin-bottom: 30px;
	}

	.ueditor {
		width: 500px;
		height: 400px;
		margin-bottom: 30px;
	}
	/* end 富文本编辑器 */
	/* start upload */

	.avatar-uploader .el-upload {
		border: 1px dashed #d9d9d9;
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		line-height: 40px !important;
		overflow: initial !important;
	}

	.avatar-uploader .el-upload:hover {
		border-color: #20a0ff;
	}

	.avatar-uploader-icon {
		font-size: 12px;
		color: #8c939d;
		width: 40px;
		height: 40px;
		line-height: 40px;
		text-align: center;
	}

	.avatar {
		width: 40px;
		height: 40px;
		display: block;
	}

	.addgoodTab {
		border-left: 1px solid rgb(223, 234, 236);
		border-top: 1px solid rgb(223, 234, 236);
		clear: both;
		margin-top: 15px;
	}

	.Tbuttom {
		margin-top: 25px;
	}

	.shichangjia {
		width: 800px;
		overflow: hidden;
	}

	.shichangjia span {
		float: left;
		line-height: 32px;
		margin-right: 10px;
	}

	.shichangjia input {
		width: 300px;
		float: left;
	}
	/* start 下拉的按钮样式 */

	.kael {
		position: absolute;
		width: 100%;
		bottom: 0;
		left: 0;
		border-top: 1px solid #e9e9e9;
		background: #fff;
		padding: 6px 10px;
	}

	.kael>span {
		color: #48626a;
	}
	/* end 下拉的按钮样式 */
	/*.avatar-uploader{
		cursor: pointer !important;
	}
	.avatar-uploader:hover .avatar-uploader-icon {
		border-color: #03B8CC;
	}
	.avatar-uploader-icon {
    border-radius: 6px;
		font-size: 12px;
		padding: 15px;
		border: 1px dashed #d9d9d9;
	}
	.crop-box .g-resize {
		background-color: red !important;
	}*/
	/* end upload */
</style>
